<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>

  <script>



    // async function show () {
    //   await init();
    //   console.log("show()函数");
    //   return "show的返回值"
    // }
    // // console.log(show());//Promise

    // show().then((data) => {
    //   console.log(data);
    // })

    function init () {
      return new Promise((resolve, reject) => {
        setTimeout(() => {
          console.log("成功1");
          resolve('成功')
        }, 5000);
      })
    }

    async function show () {
      await init().then((data) => {
        console.log(data);
      })
      console.log("show()函数");
      setTimeout(() => {
        console.log("show函数内的定时器");
      }, 3000);
    }
    show();
  </script>
</body>

</html>